package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.ProductSkuCUDClient;
import com.zqh.myfmmall.result.Result;
import com.zqh.myfmmall.rowbeans.entity.ProductSku;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-19 19:19
 */
@Slf4j
public class ProductSkuCUDClientFallback implements FallbackFactory<ProductSkuCUDClient>{
    @Override
    public ProductSkuCUDClient create(Throwable cause) {
        log.warn("exception in calling productskucud service" + cause);
        return new ProductSkuCUDClient(){
            @Override
            public Result add(ProductSku productSku) {
                return Result.internalServerError();
            }

            @Override
            public Result update(ProductSku productSku) {
                return Result.internalServerError();
            }

            @Override
            public Result updateBatch(List<ProductSku> productSkus) {
                return Result.internalServerError();
            }

            @Override
            public Result delete(ArrayList<String> ids) {
                return Result.internalServerError();
            }
        };
    }
}
